- Get inspired with the COLOR INSIGHT shared by talented designers.
- The package hunt (crawling) the color HEX codes from https://dribbble.com/, then generate the color palette.
- https://github.com/adatalab/colorhunt
devtools::create("colorhunt")
Package: colorhunt
Type: Package
Title: A package for hunting the color instight
Version: 0.1.0
Authors@R: person("Youngjun", "Na", email = "ruminoreticulum@gmail.com",
role = c("aut", "cre"))
Description: The package scraping the color code from colorhunt.co,
then generate the palette for 'ggplot2'.
License: GPL-2
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
URL: https://github.com/adatalab/colorhunt
BugReports: https://github.com/adatalab/colorhunt/issues
devtools::use_package(
"dplyr", "rvest", "crayon", "magrittr", "xml2", "stringr", "clipr"
)
library(rvest)
library(dplyr)
colors <- url %>%
read_html() %>%
html_nodes(".color") %>%
html_children() %>%
html_text()
return(colors)
series <- unique(colorhunt::lego$name) length(series)
## [1] 379
head(series, 20)
## [1] "12V" "4 Juniors" ## [3] "4.5V" "9V" ## [5] "Advent" "Advent Sub-Set" ## [7] "Adventurers" "Agents" ## [9] "Agori" "Airjitzu" ## [11] "Airport" "Alien Conquest" ## [13] "Alpha Team" "An Unexpected Journey" ## [15] "Angry Birds" "Animals" ## [17] "Aquanauts" "Aquaraiders I" ## [19] "Aquaraiders II" "Aquasharks"
colors <- colorhunt::lego %>% filter(color != "#FFFFFF") %>% filter(color != "#FCFCFC") %>% filter(name == series) %>% pull(color) %>% unique() return(colors)
# install.packages("remotes")
remotes::install_github("adatalab/colorhunt")
library(colorhunt)
library(ggplot2)
library(dplyr)
# Good! But, in this way, you use the resources every time.
colors <- color_hunt(url = "https://dribbble.com/shots/6393225-Iris")
# Great! Just push the Ctrl + V button!
color_hunt(url = "https://dribbble.com/shots/6393225-Iris")
colors <- c('#FFFAEB', '#538F6D', '#BA680D', '#E99E29', '#FDE75C', '#2F545F', '#CBC4C3', '#6D8A96')
iris %>%
ggplot(aes(Sepal.Length, Sepal.Width, color = Species)) +
geom_point(size = 2) +
scale_color_manual(values = colors[-1]) +
theme(
panel.background = element_rect(fill = colors[1])
)
colors <- color_lego("Ferrari")
mpg %>%
group_by(class) %>%
summarise(displ = mean(displ)) %>%
ggplot(aes(reorder(class, displ), displ, fill = class)) +
geom_col() +
scale_fill_manual(values = color_lego("Ferrari"))